package org.leviatan.definator.client;

import java.util.Collection;
import java.util.Map;

import org.leviatan.definator.client.local.LocalServiceProxy;
import org.leviatan.definator.client.remote.RemoteServiceProxy;
import org.leviatan.definator.core.admin.DefinatorAdminService;
import org.leviatan.definator.core.model.Field;
import org.leviatan.definator.core.model.Record;
import org.leviatan.definator.core.model.Table;

public abstract class DefinatorServiceProxy implements DefinatorAdminService {
	
	public static DefinatorServiceProxy buildLocalProxy() {
		return new LocalServiceProxy();
	}
	
	public static DefinatorServiceProxy buildRemoteProxy() {	
		return new RemoteServiceProxy();
	}

	public abstract Map getFieldDefinitions();

	public abstract Map getRecordDefinitions();

	public abstract Map getTableDefinitions();
	
	public abstract Collection getTablesRecordIds(String tblId);
	
	public abstract Collection getRecordsFieldIds(String recId);
	
	public abstract Table getTableModel(String aId);
	
	public abstract Record getRecordModel(String aId);
	
	public abstract Field getFieldModel(String aId);

	public abstract Field addFieldModel(Field fld);

	public abstract Record addRecordModel(Record rec);

	public abstract Table addTableModel(Table tbl);

	public abstract String getFieldsRecordId(String fldId);

	public abstract String getRecordsTableId(String recId);

	public abstract void loadConfiguration(String filePath);

	public abstract void loadModels();

	public abstract void loadRegister();

	public abstract boolean removeFieldModel(String fldId);

	public abstract boolean removeRecordModel(String recId);

	public abstract boolean removeTableModel(String tblId);

	public abstract void saveModels();

	public abstract boolean updateFieldModel(String fldId, Field fldModel);

	public abstract boolean updateRecordModel(String recId, Record recModel);

	public abstract boolean updateTableModel(String tblId, Table tblModel);

	public abstract boolean updateFieldLength(String fldId, int newLength);

	public abstract boolean updateFieldModel(String fldId, String newName, 
			int newLength, String newType, String newRef);

	public abstract boolean updateFieldName(String fldId, String newName);

	public abstract boolean updateFieldRecordRef(String fldId, String newRef);

	public abstract boolean updateFieldType(String fldId, String newType);

	public abstract boolean updateRecordName(String recId, String newName);

	public abstract boolean updateTableName(String tblId, String newName);

	public abstract String createNewFieldModel();

	public abstract String createNewFieldModel(String name, int length, String type, String recRef);

	public abstract String createNewRecordModel();

	public abstract String createNewRecordModel(String name, String tblRef);

	public abstract String createNewTableModel();

	public abstract String createNewTableModel(String name);

}
